//
//  QMIMViewController.m
//  Camera
//
//  Created by gml on 2019/2/14.
//  Copyright © 2019年 gml. All rights reserved.
//

#import "QMIMViewController.h"
//#import <FMDB.h>
//#import <QiniuSDK.h>
//#import <AFNetworking.h>
//#import <QMLineSDK/QMLineSDK.h>
#import "QTVertificationCodeInputView.h"
#import <CRBoxInputView.h>

@interface QMIMViewController ()

@end

@implementation QMIMViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    [QMConnect registerSDKWithAppKey:@"b37cbf50-2f5a-11e9-a40a-331b7f425f67" userName:@"123abc" userId:@"1234567890"];
    
//    QTVertificationCodeInputView *vertificationCodeInputView = [[QTVertificationCodeInputView alloc]initWithFrame:CGRectMake(30, 100, kMainBoundsWidth-30*2, 50)];
//    vertificationCodeInputView.numberOfVertificationCode = 4;
//    vertificationCodeInputView.lineWidth = 1;
//    vertificationCodeInputView.spacing = 10;
//    vertificationCodeInputView.font = [UIFont systemFontOfSize:25];
//    vertificationCodeInputView.cornerRadius = 5;
//    vertificationCodeInputView.backgroundColor = [UIColor whiteColor];
//    vertificationCodeInputView.block = ^(UITextField *textField) {
//        NSLog(@" 输入 = %@",textField.text);
//        if (textField.text.length==4) {
//            [textField resignFirstResponder];
//        }
//    };
//    [self.view addSubview:vertificationCodeInputView];
    
    CRBoxInputView *boxInputView = [[CRBoxInputView alloc] initWithFrame:CGRectMake(30, 100, 200, 50)];
    [boxInputView loadAndPrepareViewWithBeginEdit:YES]; // BeginEdit:是否自动启用编辑模式
    [self.view addSubview:boxInputView];
    
    // 获取值
    // 方法1, 当输入文字变化时触发回调block
    boxInputView.textDidChangeblock = ^(NSString *text, BOOL isFinished) {
        NSLog(@"text:%@", text);
    };
    // 方法2, 普通的只读属性
    NSLog(@"textValue:%@", boxInputView.textValue);
    
    // 清空
    [boxInputView clearAllWithBeginEdit:YES]; // BeginEdit:清空后是否自动启用编辑模式
    
}
@end
